#include<bits/stdc++.h>
using namespace std;

int main() {
	int t;
	cin >> t;
	while(t -- ) {
		string s;
		cin >> s;
		if(s.size() == 1) {
			cout << "NO" << endl;
			continue ;
		}
		bool flag = false;
		for(int i = 1; i < s.size(); i ++ ) {
			if(s[i] > s[i - 1] ) {
				flag = true;
				break;
			}
		}

		cout << (flag == true ? "YES\n" : "NO\n");
	}
	return 0;
}

